package com.topsail.demo.xxx.facade;

import com.topsail.demo.context.JwtUtils;
import com.topsail.demo.xxx.api.Rest;
import com.topsail.demo.xxx.api.facade.TokenFacade;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.apache.shenyu.client.dubbo.common.annotation.ShenyuDubboClient;

import java.util.HashMap;
import java.util.Map;

@Slf4j
@DubboService
public class TokenFacadeImpl implements TokenFacade {

    @Override
    @ShenyuDubboClient(path = "createJwt")
    public Rest createJwt(Long userId, String username) {
        Map<String, Object> claims = new HashMap<>();
        claims.put("userId", userId);
        claims.put("username", username);
        return Rest.success(JwtUtils.createJwt(userId, username));
    }

}
